import 'package:flutter_test/flutter_test.dart';
import 'package:lark_auth/lark_auth.dart';
import 'package:lark_auth/lark_auth_platform_interface.dart';
import 'package:lark_auth/lark_auth_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockLarkAuthPlatform
    with MockPlatformInterfaceMixin
    implements LarkAuthPlatform {
  @override
  Future<String?> startSSOVerify({
    required String appId,
    bool? challengeMode = false,
    String? server = 'Feishu',
    String? language = 'zh',
    String? deviceId,
    List<String>? scopeList = defaultScopeList,
  }) =>
      Future.value('42');
}

void main() {
  final LarkAuthPlatform initialPlatform = LarkAuthPlatform.instance;

  test('$MethodChannelLarkAuth is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelLarkAuth>());
  });

  test('startSSOVerify', () async {
    LarkAuth larkAuthPlugin = LarkAuth();
    MockLarkAuthPlatform fakePlatform = MockLarkAuthPlatform();
    LarkAuthPlatform.instance = fakePlatform;

    expect(await larkAuthPlugin.startSSOVerify(appId: "cli_a5edba68867f5013"),
        '42');
  });
}
